package com.su.sweet.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.su.sweet.model.SUserRole;
import com.su.sweet.mapper.SUserRoleMapper;
import com.su.sweet.service.ISUserRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.noear.solon.annotation.Component;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author su
 * @since 2025-01-02
 */
@Component
public class SUserRoleServiceImpl extends ServiceImpl<SUserRoleMapper, SUserRole> implements ISUserRoleService {

    @Override
    public List<SUserRole> getUserRoles(Long userId) {
        return this.lambdaQuery()
                .eq(SUserRole::getUserId, userId)
                .list();
    }

    @Override
    public List<SUserRole> getRoleUsers(Long roleId) {
        return this.lambdaQuery()
                .eq(SUserRole::getRoleId, roleId)
                .list();
    }
}
